extends KinematicBody2D

var velocity = Vector2.ZERO	
var gravity = 1000

func _ready():
	$DeathSoundPlayer1.play()
	$DeathSoundPlayer2.play()
	$DeathSoundPlayer3.play()
	
	if (velocity.x > 0):
		$Visuals.scale = Vector2(-1, 1)

func _process(delta):
	velocity.y += gravity * delta
	velocity = move_and_slide(velocity, Vector2.UP)	# 第二个参数告诉移动函数地面法向量向上

	if (is_on_floor()):
		velocity.x = lerp(0, velocity.x, pow(2, -1 * delta))	# 通过线性插值让速度变化更加平滑
	
